package com.coocaa.ops.common.core.base.util;


import com.coocaa.ops.common.core.base.enums.ResourceStatusEnums;

/**
 * @author bijiahao
 * @date : 2018/7/26.
 * @description: 资源状态 校验器
 */
public final class ResourceStatusValidator {
    /**
     * 合成海报按钮
     *
     * @param status
     * @return
     */
    public static boolean isCanAddPosterMergeBtn(Integer status) {
        return null != status && (status == ResourceStatusEnums.OFF_LINE.getStatus()
                || status == ResourceStatusEnums.ON_LINE.getStatus()
                || status == ResourceStatusEnums.TO_AUDITING.getStatus()
        );
    }

    /**
     * 是否下架状态或者二次待审核状态
     *
     * @param status
     * @return
     */
    public static boolean isOffLineOrSecondToAuditing(Integer status) {
        return null != status && (status == ResourceStatusEnums.OFF_LINE.getStatus() || status == ResourceStatusEnums.SECOND_TO_AUDITING.getStatus());
    }

    /**
     * 审核通过状态
     *
     * @param status
     * @return
     */
    public static boolean isOnline(Integer status) {
        return null != status && ResourceStatusEnums.ON_LINE.getStatus() == status;
    }

    /**
     * 审核通过未上线
     *
     * @param status
     * @return
     */
    public static boolean isAuditNotOnline(Integer status) {
        return null != status && ResourceStatusEnums.AUDITED_NOT_ON_LINE.getStatus() == status;
    }

    /**
     * 不是审核通过状态
     *
     * @param status
     * @return
     */
    public static boolean isNotOnline(Integer status) {
        return null == status || ResourceStatusEnums.ON_LINE.getStatus() != status;
    }

    /**
     * 审核通过状态
     *
     * @param status
     * @return
     */
    public static boolean isNotAuditPassed(Integer status) {
        return null != status && ResourceStatusEnums.AUDITED_NOT_PASS.getStatus() == status;
    }

    /**
     * 下架状态
     *
     * @param status
     * @return
     */
    public static boolean isOffline(Integer status) {
        return null != status && ResourceStatusEnums.OFF_LINE.getStatus() == status;
    }

    /**
     * 审核通过状态 或者 下架状态
     *
     * @param status
     * @return
     */
    public static boolean isOnlineOrOffline(Integer status) {
        return null != status && (status == ResourceStatusEnums.ON_LINE.getStatus() || status == ResourceStatusEnums.OFF_LINE.getStatus());
    }

    /**
     * 是否待审核状态
     *
     * @param status
     * @return
     */
    public static boolean isToAuditing(Integer status) {
        return null != status && ResourceStatusEnums.TO_AUDITING.getStatus() == status;

    }

    public static boolean isDraft(Integer status) {
        return null != status && ResourceStatusEnums.DRAFT.getStatus() == status;

    }


    public static boolean isToAuditingOrDraft(Integer status) {
        return null != status && (ResourceStatusEnums.TO_AUDITING.getStatus() == status || ResourceStatusEnums.DRAFT.getStatus() == status);
    }
}
